package scala.p1

import scala.collection._
import util.control.Breaks._

/**
 * Created by IntelliJ IDEA.
 *
 */

import java.util.{Date, Locale}
import collection.immutable.HashMap

object Breed extends Enumeration {
  val doberman = Value("Doberman Pinscher")
  val yorkie = Value("Yorkshire Terrier")
  val scottie = Value("Scottish Terrier")
  val dane = Value("Great Dane")
  val portie = Value("Portuguese Water Dog")
}

object A {

  def xx(a: Breed.Value){
    println("breed type="+a)
  }

  class C(i:Int){

    def *(s:String) = {
      new C(i*100)
    }

    def mkBigger(k:Int) = new C(i*k)

    override def toString = "i="+i
  }



  def main(args : Array[String]):Unit={
    xx(Breed.yorkie)


    var cd = new C(5)
    cd = new C(6)
    //cd mkBigger= 10
    println(cd+" "+ cd*"t" )
    format("===%s===",234)
    "qwe[123]".r


    val vv = new mutable.HashSet[Int]
    breakable {
      for(i<-1 to 100 ){
        break
        vv.add(i)
      }
    }

    val vvj = new java.util.HashSet[java.lang.Integer]
    for(i<-1 to 100 ) vvj.add(i)

    val l = List(1,2,3,4,5,6,7,8,9)
    val m = Map() ++ (l map (o => (o,o*o)))
    println(m+ " "+m.getClass)
    println(new java.util.Date)
    val m1 = (new mutable.HashMap[Int,Int] /: l){ case (h,i) => h.put(i, i*i); h }
    println(m1)

   // val CSB = new C{ type T=StringBuilder }
   // println( CSB.getClass+" "+CSB.newInst )
  }
 /*
  abstract class C{
    type T <: AnyRef
    def newInst = {
      //val c = classOf[T]
      T.newInstance
    }
  }
  */
}
